import { request } from '@boeyo/portal';

/***********************************通知管理组***********************************/
/**
 *  新增角色组
 */
export const createRoleGroup = (data: any) => {
  return request({
    url: 'roleGroup/add',
    method: 'POST',
    data,
  });
};

/**
 * 修改角色组
 */
export const updateRoleGroup = (data: any) => {
  return request({
    url: 'roleGroup/update',
    method: 'PUT',
    data,
  });
};

/**
 * 角色组列表
 */
export const fetchRoleGroup = (params?: any) => {
  return request({
    url: 'roleGroup/list',
    params,
  });
};

/**
 * 删除角色组
 */
export const deleteRoleGroup = (id: number) => {
  return request({
    url: `roleGroup/delete/${id}`,
    method: 'DELETE',
  });
};

/**
 * 角色组成员
 */
export const fetchRoleGroupUser = (params: any) => {
  return request({
    url: 'roleGroupItem/list',
    params,
  });
};

/**
 * 新增角色组成员
 */
export const createRoleGroupUser = (data: any) => {
  return request({
    url: 'roleGroupItem/add',
    method: 'POST',
    data,
  });
};

/**
 * 更新角色组成员
 */
export const updateRoleGroupUser = (data: any) => {
  return request({
    url: 'roleGroupItem/update',
    method: 'PUT',
    data,
  });
};

/**
 * 删除角色组成员
 */
export const deleteRoleGroupUser = (ids: number[]) => {
  return request({
    url: `roleGroupItem/delete/${ids}`,
    method: 'DELETE',
  });
};

/**
 * 系统用户下拉
 */
export const fetchUsers = () => {
  return request({
    url: 'roleGroupItem/sysUserList',
  });
};

/**
 * 获取部门
 */
export const getDeptSelect = (params?: any) => {
  return request({
    url: 'roleGroupItem/treeselect',
    method: 'GET',
    params,
  });
};
